// let items = new Array(2)
// console.log(items.length) // 2
// console.log(items[0]) // undefined
// console.log(items[1]) // undefined


// let items = Array.of(1, 2)
// console.log(items.length) // 2
// console.log(items[0]) // 1
// console.log(items[1]) // 2

// function fromArray () {
//   return Array.from(arguments, value => value + 10)
// }
// console.log(fromArray(1, 2, 3, 4, 5)) // [ 11, 12, 13, 14, 15 ]

// let helper = {
//   diff: 1,
//   add (value) {
//     return value + this.diff
//   }
// }

// const array = Array.from([1, 2, 3], helper.add, helper)
// console.log(array) // [ 2, 3, 4 ]

// let numbers = [25, 10, 35, 30, 45, 40]
// console.log(numbers.find(n => n > 33)) // 35
// console.log(numbers.findIndex(n => n > 33)) // 2

// let numbers = [25, 10, 35, 30, 45, 40]
// numbers.fill(1)
// console.log(numbers) // [ 1, 1, 1, 1, 1, 1 ]
// let numbers = [25, 10, 35, 30, 45, 40]
// console.log(numbers.fill(1, 2, 4)) //[ 25, 10, 1, 1, 45, 40 ]
// console.log(numbers.fill(1, 2)) // [ 25, 10, 1, 1, 1, 1 ]


let numbers = [25, 10, 35, 30, 45, 40]
// 从数组的索引2开始粘贴值
// 从数组的索引0开始复制值
// 索引2时停止复制值
numbers.copyWithin(2, 0, 2)
console.log(numbers) // [ 25, 10, 25, 10, 45, 40 ]